﻿Ext.define('Examples.tree.menuitem.model.Model', {
    requires: ['Happy.data.proxy.Ajax'],
    extend: 'Happy.data.TreeModel',

    serverRootId: '\\',
    idProperty: 'Id',
    fields: [
        'Id',
        'Name',
        'ParentId'
    ],
    proxy: {
        type: 'happy-ajax',
        actionMethods: {
            create: 'GET',
            read: 'GET',
            update: 'GET',
            destroy: 'GET'
        },
        api: {
            create: 'app/MenuItem/server/create.txt',
            read: 'app/MenuItem/server/Read.aspx',
            update: 'app/MenuItem/server/update.txt',
            destroy: 'app/MenuItem/server/destroy.txt'
        },
        reader: {
            type: 'json',
            root: 'items',
            idProperty: 'Id',
            messageProperty: 'message'
        },
        writer: {
            type: 'json',
            encode: true,
            root: 'item'
        }
    }
});